package trss.model.torrent;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity
@Table(name = "metafile_announcelist")
public class AnnounceList implements Serializable{
    private static final long serialVersionUID = -9158673790491779338L;
    private Long id;
    private List<String> announce = new ArrayList<String>();
    
    public AnnounceList(){}
    /**
     * @return the id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }
    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }
    /**
     * @param e
     * @return
     * @see java.util.List#add(java.lang.Object)
     */
    public boolean add(String e) {
        return announce.add(e);
    }
    /**
     * @param index
     * @return
     * @see java.util.List#get(int)
     */
    public String get(int index) {
        return announce.get(index);
    }
    /**
     * @return the announce
     */
    public List<String> getAnnounce() {
        return announce;
    }
    /**
     * @param announce the announce to set
     */
    public void setAnnounce(List<String> announce) {
        this.announce = announce;
    }
    /**
    * ${@inheritDoc}
    */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result
                + ((announce == null) ? 0 : announce.hashCode());
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }
    /**
    * ${@inheritDoc}
    */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        AnnounceList other = (AnnounceList) obj;
        if (announce == null) {
            if (other.announce != null) {
                return false;
            }
        } else if (!announce.equals(other.announce)) {
            return false;
        }
        if (id == null) {
            if (other.id != null) {
                return false;
            }
        } else if (!id.equals(other.id)) {
            return false;
        }
        return true;
    }
    

}
